package com.nine.pesys.model.action;

import com.nine.pesys.base.BaseAction;
import com.nine.pesys.model.entity.SportField;
import com.nine.pesys.util.annotation.Privilege;
import com.opensymphony.xwork2.ActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

/**
 *
 * Created by L先森 on 2014/12/26.
 */
@Controller
@Scope("prototype")
@Namespace("/field")
@ParentPackage("my_struts")
@Results({
})
@Privilege
public class SportFieldAction extends BaseAction<SportField>{

    @Privilege("super")
    @Action("/allSportField")
    public String allSportField() throws Exception{
        sportFields = this.sportFieldService.findAll();
        if(sportFields.size()>0)
            ActionContext.getContext().put("sportFields",sportFields);
        return "sportFields";
    }
}
